import QtQuick 2.0


Component{
    Rectangle{
        id:dockBtn
        anchors.fill: parent
        color:cardColor
        state: "released"

        property string title
        property url iconUrl
        signal dockBtnClicked(string title)

        states: [
            State {
                name: "pressed"
                PropertyChanges { target: dockBtn; color: btnColorPressed }
            },
            State {
                name: "released"
                PropertyChanges { target: dockBtn; color: btnColor }
            }
        ]

        Image{
            id:dockLightOnImage
            source: iconUrl
            anchors.centerIn: parent
        }
        Text{
            text: title
            color: textColor
            anchors.top: dockLightOnImage.bottom
            anchors.horizontalCenter: dockLightOnImage.horizontalCenter
        }
        MouseArea{
            anchors.fill: parent
            onClicked:{
                dockBtnClicked(title)
            }
            onPressed: {
                dockBtn.state = "pressed"
            }
            onReleased: {
                dockBtn.state = "released"
            }
        }
    }
}

